@echo off
chcp 65001 >nul
echo ========================================
echo 部署请假审批流程到 Flowable
echo ========================================
echo.

cd /d "%~dp0"

echo [1/3] 检查 Flowable 服务状态...
curl -s -u rest-admin:test http://localhost:8080/flowable-rest/service/management/engine >nul 2>&1
if %errorlevel% neq 0 (
    echo ❌ Flowable 服务未启动或无法访问
    echo    请先启动 Flowable: start_flowable.bat
    pause
    exit /b 1
)
echo ✅ Flowable 服务运行正常
echo.

echo [2/2] 部署流程定义...
python deploy_leave_process.py
if %errorlevel% neq 0 (
    echo.
    echo ❌ 流程部署失败
    pause
    exit /b 1
)
echo.

echo ========================================
echo ✨ 部署完成!
echo ========================================
echo.
echo 下一步: 启动 Python 服务器
echo    cd ..\server
echo    python run.py
echo.
pause
